Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e test for storage class diskformat verification for vsphere cloud provider #41239

Merged

Conversation

divyenpatel
Copy link
Member

@divyenpatel divyenpatel commented Feb 10, 2017

What this PR does / why we need it:
This PR adds a new e2e test for vsphere cloud provider.
Test is to verify diskformat specified in storage-class is being honored while volume creation.

Steps:

  1. Create StorageClass with diskformat set to valid type (supported options are eagerzeroedthick, zeroedthick and thin)
  2. Create PVC which uses the StorageClass created in step 1.
  3. Wait for PV to be provisioned.
  4. Wait for PVC's status to become Bound
  5. Create POD using PVC on specific node.
  6. Wait for Disk to be attached to the node.
  7. Get node VM's devices and find PV's Volume Disk.
  8. Get Backing Info of the Volume Disk and obtain Property of VirtualDiskFlatVer2BackingInfo - EagerlyScrub and ThinProvisioned
  9. Based on the value of EagerlyScrub and ThinProvisioned, verify if diskformat is correct.
  10. Delete POD and Wait for Volume Disk to be detached from the Node.
  11. Delete PVC, PV and Storage Class

Which issue this PR fixes *
fixes #

Special notes for your reviewer:
Test is executed against v1.6.0-alpha.1
Test is failing on v1.4.8

Release Note

NONE

@kerneltime @BaluDontu @abrarshivani please review this PR

@k8s-ci-robot
Copy link
Contributor

Hi @divyenpatel. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 10, 2017
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Feb 10, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@kerneltime
Copy link

@k8s-bot ok to test

@divyenpatel
Copy link
Member Author

@jeffvance can you also review?

@jeffvance
Copy link
Contributor

jeffvance commented Feb 10, 2017

@divyenpatel probably need to add
"```release-note
NONE
```"
tag to this pr.

if err != nil {
return nil, err
}
vs := VSphere{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not vs := &VSphere{ ... ?
Then remove & below? There may be a good reason for not doing this but it is a fairly common pattern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. followed common pattern.

@@ -178,3 +179,89 @@ func verifyContentOfVSpherePV(client clientset.Interface, pvc *v1.PersistentVolu
runInPodWithVolume(client, pvc.Namespace, pvc.Name, "grep '"+expectedContent+"' /mnt/test/data")
framework.Logf("Sucessfully verified content of the volume")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Successfully..."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

scAnnotation := make(map[string]string)
scAnnotation["volume.beta.kubernetes.io/storage-class"] = storageclass.Name

claim := v1.PersistentVolumeClaim{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question about why not using:
claim := &v1.PersistentVolumeClaim{

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. followed common pattern.

@k8s-github-robot k8s-github-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Feb 10, 2017
11. Delete PVC, PV and Storage Class
*/

var _ = framework.KubeDescribe("Volume Disk Format", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding [Volume] and [vsphere] tags

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.
framework.KubeDescribe("Volume Disk Format [Feature:Volumes] [vsphere]", func() {
Also added vsphere tag in vsphere_volume_placement.go

Copy link
Contributor

@jeffvance jeffvance Feb 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep -R "\[Feature:Volumes\]" test | wc -l
3
grep -R "\[Volume\]" test |wc -l
82

so, for now, [Volume] (singular) is far more common.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will use Volume then

client.CoreV1().PersistentVolumeClaims(namespace).Delete(pvclaimSpec.Name, nil)
}()

By("Waiting for calim to be in bould phase")
Copy link
Contributor

@jeffvance jeffvance Feb 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"claim", "bound"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. Will turn on spell checker my IDE next time.

PV is required to be attached to the Node. so that using govmomi API we can grab Disk's Backing Info
to check EagerlyScrub and ThinProvisioned property
*/
By("Creating POD to attach PV to the node")
Copy link
Contributor

@jeffvance jeffvance Feb 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "POD" is not an acronym like "PV" is. Usually lowercase "pod" is displayed in messages.

By("Creating POD to attach PV to the node")
// Create POD to attach Volume to Node
podSpec := getVSpherePodSpecWithClaim(pvclaim.Name, nodeKeyValueLabel, "while true ; do sleep 2 ; done")
pod, err := client.CoreV1().Pods(namespace).Create(podSpec)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test for err missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added assert check for all err

f := find.NewFinder(govMoMiClient.Client, true)
ctx, _ := context.WithCancel(context.Background())
vm, err := f.VirtualMachine(ctx, os.Getenv("VSPHERE_WORKING_DIR")+nodeName)
vmDevices, err := vm.Device(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is an err check needed here?

11. Delete PVC, PV and Storage Class
*/

var _ = framework.KubeDescribe("Volume Disk Format", func() {
var _ = framework.KubeDescribe("Volume Disk Format [Feature:Volume] [vsphere]", func() {
Copy link
Contributor

@jeffvance jeffvance Feb 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand the difference between "[Feature:xyz]" vs "[xyz]". This doc describes "Feature:" as:
"If a test has non-default requirements to run or targets some non-core functionality, and thus should not be run as part of the standard suite. "
So, my choice would be to simply use [Volume] as the tag, as done in ~82 other tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it would be easier to filter vsphere related tests with adding [vsphere] tag.
but if this is not the convention, let’s remove this.

@@ -109,17 +109,21 @@ func invokeTest(client clientset.Interface, namespace string, nodeName string, n
By("Creating Storage Class With DiskFormat")
storageClassSpec := getVSphereStorageClassSpec("thinsc", scParameters)
storageclass, err := client.StorageV1beta1().StorageClasses().Create(storageClassSpec)
Expect(err).NotTo(HaveOccurred())

defer client.StorageV1beta1().StorageClasses().Delete(storageclass.Name, nil)
Expect(err).NotTo(HaveOccurred())
Copy link
Contributor

@jeffvance jeffvance Feb 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant with L112. I may have given a poor review comment previously?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed redundant check. Thanks for detailed review.

@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/test/e2e/framework"
)

var _ = framework.KubeDescribe("Volume Placement [Feature:Volume]", func() {
var _ = framework.KubeDescribe("Volume Placement [Feature:Volume] [vsphere]", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same "Feature:" comment as above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@kerneltime
Copy link

/approve

1 similar comment
@spxtr
Copy link
Contributor

spxtr commented Feb 13, 2017

/approve

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 13, 2017
@divyenpatel
Copy link
Member Author

@jeffvance addressed all review comments.

11. Delete PVC, PV and Storage Class
*/

var _ = framework.KubeDescribe("Volume Disk Format [Feature:Volume]", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's been some back and forth here. IMO, this line should be:
var _ = framework.KubeDescribe("Volume Disk Format [Volumes]", func() {...
In a previous comment I've shown about 25x more occurences in test/ of my suggestion vs what you have above. But I may be misunderstanding how [Feature:xyz]` works, or vsphere may have special needs here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. There is no special need in vpshere. Just followed same pattern as in volumes.go

@jeffvance
Copy link
Contributor

@divyenpatel One comment above. Overall, looks good to me; however I am not an assignee so I cannot add LGTM.

adding govmomi dep to test/e2e/BUILD
adding golang.org/x/net/context to e2e deps
addressed review comments
addressed 2nd round of review comments

addressed review comments regarding KubeDescribe tagging
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

The following people have approved this PR: divyenpatel, kerneltime, spxtr

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@divyenpatel
Copy link
Member Author

@deads2k can you review and approve this change?

@deads2k deads2k assigned jeffvance and unassigned deads2k Feb 15, 2017
@jeffvance
Copy link
Contributor

@k8s-bot verify test this

@divyenpatel
Copy link
Member Author

@jeffvance Jenkins verification passed.

@jeffvance
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 15, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 37137, 41506, 41239, 41511, 37953)

@k8s-github-robot k8s-github-robot merged commit 6823803 into kubernetes:master Feb 16, 2017
@divyenpatel divyenpatel deleted the e2eTestsUpdate-v2 branch September 5, 2017 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants